package com.pj.wisdomlogistics.mvp.presenter;


import com.pj.wisdomlogistics.entity.HomePageInfo;
import com.pj.wisdomlogistics.mvp.contract.WisdomLogisticsContract;
import com.pj.wisdomlogistics.mvp.frame.ActivityPresenter;
import com.pj.wisdomlogistics.mvp.model.WisdomLogisticsModel;
import com.pj.wisdomlogistics.rx.FilterSubscriber;

import java.io.File;


public class WisdomLogisticsPresenter extends ActivityPresenter<WisdomLogisticsModel,WisdomLogisticsContract.View> implements WisdomLogisticsContract.Presenter{
    public static final String TAG = "WisdomLogisticsPresenter";

    @Override
    public void saveSignPath(String userID, File sign) {
        addSubscription(getModel().saveSignPath(userID, sign), new FilterSubscriber<String>() {
            @Override
            public void onNext(String mS) {
                getView().onSuccess(mS);
            }

            @Override
            public void onError(int errorCode, String errorMsg) {
                getView().onError(errorMsg);
            }

        });
    }

    @Override
    public void home(String userID) {
        addSubscription(getModel().home(userID), new FilterSubscriber<HomePageInfo>() {
            @Override
            public void onNext(HomePageInfo mInfo) {
                getView().onHomeSuccess(mInfo);
            }

            @Override
            public void onError(int errorCode, String errorMsg) {
                getView().onError(errorMsg);
            }

        });
    }
}
